package com.nq.utils;

import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpUtil;

import java.util.Map;

/**
 * 穿云API
 */
public class CloudbyPassUtil {

    private final static String API_KEY = "009066df104b454495bbe22d9c8453fc";

    public static String httpGet(String url, Map<String, Object> params) {
        String host = URLUtil.toURI(url).getHost();
        url = url.replace(host, "api.cloudbypass.com");
        String body = HttpUtil.createGet(url)
                .header("x-cb-apikey", API_KEY)
                .header("x-cb-host", host)
                .form(params)
                .execute()
                .body();
        return body;
    }


}
